<table class="easyui-treegrid dispatch_order_search_result" title="" style="width:100%,height:250px"
       data-options="singleSelect:true,collapsible:true,idField: '_id',treeField: '_name'">
    <thead>
    <tr>
        <th data-options="field:'_name',width:100">商户名称</th>
        <th data-options="field:'_shopAddress',width:200">商户地址</th>
        <th data-options="field:'_createTime',width:120">创建日期</th>
        <th data-options="field:'_statusText',width:50,align:'right'">状态</th>
        <th data-options="field:'_amount',width:50">数量</th>
        <th data-options="field:'_unitPrice',width:50">单价（每公斤）</th>
        <th data-options="field:'_weight',width:50">重量（预估）</th>
        <th data-options="field:'_total',width:50">金额</th>
    </tr>
    </thead>
</table>


<script type="text/javascript">

(function(){

    $('.dispatch_order_search_result').treegrid({toolbar: [{
        text:'修改',
        iconCls: 'icon-edit',
        handler: function(){
            var selected=$('.dispatch_order_search_result').treegrid('getSelected')._id;
            $('.content .right').bigwin('loadView','forms/dispatch_prd_create_form',function(){
                if(selected){
                    $.sget('/api/admin/dispatch/orders/'+selected,{},function(data){
                        data=flatObject(data);
                        console.log(data);

                    });
                }
            });
        }
    },'-']});

    $.sget('/api/admin/dispatch/orders',{},function(data){
        flatArray(data.content);
        $('.dispatch_order_search_result').treegrid('loadData',data.content);
    });


})();


</script>